﻿using System;
using System.Windows.Forms;

namespace TextEditor
{
    

    public class A_MoveUp : A_Action
    {
        public A_MoveUp()
        {
            base.HotKey = Keys.Up;
        }

        public override string ActionName()
        {
            return "moveup";
        }

        public override bool Execute()
        {
            ZYTextElement element = (base.myOwnerDocument.Content.SelectLength < 0) ? base.myOwnerDocument.Content.PreElement : base.myOwnerDocument.Content.CurrentElement;
            ZYTextSelect parent = element as ZYTextSelect;
            if (parent == null)
            {
                parent = element.Parent as ZYTextSelect;
            }
            if ((parent != null) && parent.ContainsElements(base.myOwnerDocument.Content.GetSelectElements()))
            {
                parent.PopupList();
                return true;
            }
            base.myOwnerDocument.AutoClearSelection = true;
            base.myOwnerDocument._MoveUp();
            return true;
        }
    }
}

